import { get, post, del } from "../utils/request";
import axios from "../utils/request";

//查询免费好课里面的视频列表
export const localprodectsAPI = () => get("api/freeCourse");

//查看课程信息视频总数
export const localcourseAPI = () => get("api/course/courseDetail?id=9");

//测试接口,查看课程视频总数,不能改，不知道什么地方用了
export const testAPI = (uid) => get(`/api/course/courseDetail?id=${uid}`);

//查看总文章
export const localArticleAPI = () => axios.get(`/api/article/list/`);

/// 根据id查看文章列表请求
export const localArticle = (id) => axios.get(`/api/article/list/${id}`);

//获取套餐树
export const localComboAPI = (categoryId = "") =>
	post("/api/combo2/combo2", {
		categoryId,
	});

//发布评论
export const localWriteAPI = (cid, uid, replyId, text) =>
	post(`/api/comments/write/${cid}/${uid}?replyId=${replyId}&text=` + text);
//查询评论
export const localCommentAPI = (id, rid, page) =>
	axios.get(`/api/comments/list/${id}/${rid}?current=` + page);

//获取用户信息
export const localDataAPI = () => get("/api/user_data/info");

//获取购物车信息
export const localCartAPI = () => get("/api/scart");

//清空购物车
export const localScartAPI = (uid) => del(`/api/scart/all/${uid}`);
// export default {
// 	// 添加搜索首页历史查询记录
// 	addSearchHistory(state, payload) {
// 		// list中包含该记录的时，删除
// 		const index = state.searchHistoryList.indexOf(payload);
// 		if (index > -1) {
// 			state.searchHistoryList.splice(index, 1);
// 		}
// 		state.searchHistoryList.unshift(payload);
// 		// 历史记录中最大记20个记录
// 		const count = state.searchHistoryList.length;
// 		state.searchHistoryList.splice(20, count);
// 	},

// 	// 清除搜索首页历史查询记录
// 	clearSearchHistory(state) {
// 		state.searchHistoryList = [];
// 	},
// };
